package com.jxust.vhr.controller;

import com.jxust.debate.util.ResultEnum;
import com.jxust.debate.util.ResultVO;
import com.jxust.vhr.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author tyeerth
 * @date 2020/12/18 - 10:52
 */
@RestController
@RequestMapping("/test")
public class DemoController {

    @Autowired
    private DemoService demoService;

//    @RequestMapping("/getUser")
//    public List<DemoEntity> getUser(){
//        List<DemoEntity> result = demoService.getUser();
//        return result;
//    }
    @RequestMapping("/hello")
    public String hello(){
        return "hello 9091";
    }
    /**
     * 简单注册功能
     * @param username
     * @param password
     * @return
     */
    @PostMapping("/register")
    public Map<String, Object> register(String username, String password){
        demoService.register(username,password);
        return ResultVO.result(ResultEnum.SUCCESS,true);
    }
}